// by Xeno
private ["_vehicle"];
#include "x_setup.sqf"

#define __Poss _poss = x_sm_pos select 0;
#define __PossAndOther _poss = x_sm_pos select 0;_pos_other = x_sm_pos select 1;

x_sm_pos = [[6157.19,6246.82,0], [6123.53,6247.54,0], [6080.88,6244.99,0],  [6195.04,6254.38,0]]; // index: 9,   Helicopter Prototype at Krasnostav Airfield
x_sm_type = "normal"; // "convoy"

#ifdef __SMMISSIONS_MARKER__
if (true) exitWith {};
#endif

if (X_Client) then {	
	d_current_mission_text = "A new helicopter prototype is being tested at Molatia Airport. Destroy it before enemy troops use it.";
	d_current_mission_resolved_text = "Good job. The helicopter is destroyed.";
};

if (isServer) then {
	_xchopper = (if (d_enemy_side == "EAST") then {"Mi17_rockets_RU"} else {"Mi17_rockets_RU"});
	_randomv = floor random 2;
	__PossAndOther
	if (_randomv == 1) then {_poss = x_sm_pos select 3;};
	_pos_other2  = x_sm_pos select 2;
	_vehicle = objNull;
	_vehicle = _xchopper createvehicle (_poss);
	allunits_add set [count allunits_add, _vehicle];
	#ifndef __TT__
	_vehicle addEventHandler ["killed", {_this call XKilledSMTargetNormal}];
	#endif
	#ifdef __TT__
	_vehicle addEventHandler ["killed", {_this call XKilledSMTargetTT}];
	#endif
	_vehicle setDir 20;
	_vehicle lock true;
	sleep 2.123;
	["specops", 2, "basic", 2, _poss,90,true] spawn XCreateInf;
	sleep 2.111;
	["uaz_mg", 1, "uaz_grenade", 1, "brdm", 1, _pos_other2,1,100,true] spawn XCreateArmor;
};

if (true) exitWith {};